package security;

/*jadclipse*/// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.


import java.util.Collection;
import java.util.Iterator;

import org.springframework.security.access.AccessDecisionVoter;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.access.vote.AbstractAccessDecisionManager;
import org.springframework.security.core.Authentication;

// Referenced classes of package org.springframework.security.access.vote:
//            AbstractAccessDecisionManager

public class AffirmativeTest extends AbstractAccessDecisionManager
{

    public AffirmativeTest()
    {
    }

    public void decide(Authentication authentication, Object object, Collection configAttributes)
        throws AccessDeniedException
    {
        int deny = 0;
        Iterator i$ = getDecisionVoters().iterator();
        do
        {
            if(i$.hasNext())
            {
                AccessDecisionVoter voter = (AccessDecisionVoter)i$.next();
                int result = voter.vote(authentication, object, configAttributes);
                if(logger.isDebugEnabled())
                    logger.debug((new StringBuilder()).append("Voter: ").append(voter).append(", returned: ").append(result).toString());
                switch(result)
                {
                case 1: // '\001'
                    return;

                case -1: 
                    deny++;
                    break;
                }
                continue;
            }
            if(deny > 0)
                throw new AccessDeniedException(messages.getMessage("AbstractAccessDecisionManager.accessDenied", "Access is denied"));
            checkAllowIfAllAbstainDecisions();
            break;
        } while(true);
    }
}

